package com.boot.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.boot.service.AreaService;
import com.boot.util.AdResult;

@Controller
public class AreaController {

	@Resource
	private AreaService areaService;
	//获取省级
	@RequestMapping("/area/getProvincesAndCitys.do")
	@ResponseBody
	public AdResult getArea(){
		AdResult result=areaService.getArea();
		return result;
	}
	//根据省级代码获取其包含的市(放弃)
	@RequestMapping("/area/getCitys.do")
	@ResponseBody
	public AdResult getCitys(String areacode){
		AdResult result=areaService.getAreaCitys(areacode);
		return result;
	}
	//根据市级代码获取其包含的区县
	@RequestMapping("/area/getDistricts.do")
	@ResponseBody
	public AdResult getDistricts(String areacode){
		AdResult result=areaService.getAreaDistricts(areacode);
		return result;
	}
	//根据区县级代码获取其包含的乡镇
	@RequestMapping("/area/getTowns.do")
	@ResponseBody
	public AdResult getTowns(String areacode){
		AdResult result=areaService.getAreaTowns(areacode);
		return result;
	}
	
	
}
